function addToCart(btn) {
    var cart = new Array();
    if($.cookies.get('cart') !== null) {
        cart = $.cookies.get('cart');
    }
    
    var item = new Object();
    item.id = $(btn).attr('data-id');
    item.name = $(btn).attr('data-name');
    item.price = $(btn).attr('data-price');
    item.months = $(btn).attr('data-min');
    item.minMonths = $(btn).attr('data-min');
    
    var duplicated = false;
    
    // Find duplicated item
    for(i = 0; i < cart.length; i++) {
        if(item.id == cart[i].id) {
            cart[i].months = parseInt(cart[i].months) + parseInt(item.months);
            duplicated = true;
            break;
        }
    }
    
    if(duplicated == false) {
        cart.push(item);    
    }
    
    $.cookies.set('cart', JSON.stringify(cart));
    location.href = 'cart.html';
}